import request from './request'
export default function getUserInfo() {
  return new Promise((resolve,reject) => {
    const token = wx.getStorageSync('token')
    request({
      url: '/user/getUserInfo',
      data: {
        token
      },
      header: {
        Authorization: token
      },
      success(res) {
        const userInfo = res.data[0]
        wx.setStorageSync('userInfo', userInfo)
        getApp().globalData.userInfo = userInfo;
        resolve(userInfo)
      }
    })
  })

}